﻿<Window x:Class="InstantWatch.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:controls="clr-namespace:InstantWatch.Controls"
        xmlns:local="clr-namespace:InstantWatch"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:dropShadow="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
        Title="Instant Watch" Height="650" Width="900"
        
        Background="{StaticResource ResourceKey=NetflixRed}" Icon="/InstantWatch;component/Icons/nficon.ico">
    <Window.Resources>
        <Style x:Key="ListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
            <Setter Property="FocusVisualStyle" Value="{x:Null}" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ListBoxItem}">
                        <controls:HighlightImage ImageSource="{Binding BoxArtSource}" 
                                                 IsHightlighted="{Binding 
                                                        RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBoxItem}, 
                                                        Path=IsSelected}" />
                        
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Window.Resources>
    <DockPanel LastChildFill="True">
        <DockPanel x:Name="headerDock" DockPanel.Dock="Top" Background="#CC000000" Height="15" LastChildFill="True">
            <DockPanel.Triggers>
                <EventTrigger RoutedEvent="MouseEnter">
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="headerDock" 
                                             Storyboard.TargetProperty="Height"
                                             To="50" Duration="0:0:0.5" />
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
                <EventTrigger RoutedEvent="MouseLeave">
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="headerDock" 
                                             Storyboard.TargetProperty="Height"
                                             To="15" Duration="0:0:0.5" BeginTime="0:0:1" />
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </DockPanel.Triggers>
            <DockPanel.Resources>
                <Style TargetType="Button">
                    <Setter Property="Foreground" Value="White" />
                    <Setter Property="Margin" Value="10,15,10,10" />
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="Button">
                                <TextBlock TextDecorations="Underline">
                                    <ContentPresenter /> 
                                </TextBlock>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                    <Style.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Cursor" Value="Hand" />
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </DockPanel.Resources>
            <Button Click="RequestAuth_Click" Content="Login" DockPanel.Dock="Left" />
            <Button Click="Close_Click" Content="X" DockPanel.Dock="Right" x:Name="lnkCLose" />
            <Button x:Name="lnkFull" Content="FullScreen" DockPanel.Dock="Right" Click="lnkFull_Click" />
            <Button Click="Go_Click" Content="Go" DockPanel.Dock="Right" x:Name="lnkGo" />
        </DockPanel>

        <controls:ScrollListBox Margin="5,5,5,0" DockPanel.Dock="Top" BorderBrush="Transparent"
                                Background="{StaticResource ResourceKey=NetflixRed}" x:Name="queueList" 
                                ScrollViewer.HorizontalScrollBarVisibility="Hidden"
                                ItemContainerStyle="{StaticResource ListBoxItemStyle}"
                                >
            <controls:ScrollListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Horizontal" />
                </ItemsPanelTemplate>
            </controls:ScrollListBox.ItemsPanel>
        </controls:ScrollListBox>
        
        <Grid DockPanel.Dock="Top" Margin="0,-10,0,0">
            <Rectangle Height="15">
                <Rectangle.Fill>
                    <RadialGradientBrush GradientOrigin="0,1">
                        <GradientStop Offset="1" Color="#00000000"/>
                        <GradientStop Offset="0.5" Color="#FFFFFFFF"/>
                    </RadialGradientBrush>
                </Rectangle.Fill>
            </Rectangle>
            <Rectangle Fill="{StaticResource NetflixRed}" VerticalAlignment="Top" Height="10" HorizontalAlignment="Stretch"/>
        </Grid>
        
        <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="5*" />
                <ColumnDefinition Width="5*" />
            </Grid.ColumnDefinitions>
            <controls:QueueItemView DataContext="{Binding ElementName=queueList, Path=SelectedItem}" Grid.Column="0" VerticalAlignment="Top" Height="500" />
            <TextBlock FontSize="18" Foreground="White"
                Text="{Binding ElementName=queueList, 
                Path=SelectedItem.SynopsisSource}" Grid.Column="1" />
        </Grid>
    </DockPanel>
</Window>
